<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>乐展就要狂 百分百中大奖</title>
    <link rel="stylesheet" href="./css/style.css">
</head>

<body>
    <!-- H5页面开始 -->
    <div class="main">
        <img class="bg" src="./img/bg.png">
        <img class="sub" src="./img/sub.png">
        <img class="bg2" src="./img/bg2.png">
        <img class="sub2" src="./img/sub2.png">
        <img class="gift" src="./img/1.png" alt="">

        <input class="inp_phone" type="text" placeholder="请输入手机号码">
        <input class="inp_yzm" type="text" placeholder="请输入验证码">
        <!-- <button id="btn">重新获取</button> -->
        <input type="button" id="btn" value="点击获取" />
        
        

    </div>
    <!-- JS开始 -->
    <script src="./js/jquery-1.11.0.js"></script>
    <script src="./js/awardRotate.js"></script>
    <script>
        // 计时器开始
        $(function () {
            $('#btn').click(function () {
                var count = 5;
                var countdown = setInterval(CountDown, 1000);
                function CountDown() {
                    $("#btn").attr("disabled", true);
                    $("#btn").val( count + "秒");
                    if (count == 0) {
                        $("#btn").val("重新获取").removeAttr("disabled");
                        clearInterval(countdown);
                        console.log(1)
                    }
                    count--;
                    console.log(1)
                }
            })
        });
        // 计时器结束

        //旋转开始
        $('.sub2').click(function(){
            var level=Math.ceil(Math.random()*5)+1
            var degree=[0,35,92,155,213,275,336]
            // let num =Math.ceil(Math.random()*5)
            var angles= degree[level]
            $('.bg2').stopRotate()
            angles=Math.round(Math.random()*52)+angles
            $('.bg2').rotate({
                angle:0,
                animateTo:angles,
                duration:1000,
                callback:function(){
                    $(".gift").attr("src","img/"+level+".png")
                    $(".gift").show()
                    console.log(level)
                }
            })
            // console.log(1)
        })
        $(".gift").click(function(){
            $(".gift").hide()
        })
        //旋转结束


        
    </script>

</body>

</html>